package gugu.services.dao;

import java.util.List;

import org.springframework.data.mongodb.core.query.Query;

import gugu.domain.User;

/**
 * provide basic CRUD functions
 * 
 * @author jicui
 * 
 */
public interface CrudDao<T> {

	/**
	 * insert the document or update it ,based on if the target obj is a existing db recorder.
	 * 
	 * @param obj
	 */
	void saveOrUpdate(T obj);

	/**
	 * delete the db recorder
	 * 
	 * @param obj
	 * @return
	 */
	boolean delete(T obj);

	/**
	 * find the document by id,the type is used to decide the collection name
	 * 
	 * @param id
	 * @param type
	 * @return
	 */
	T find(String id, Class<T> type);

	/**
	 * insert a new document
	 * 
	 * @param obj
	 */
	void insert(T obj);

}
